package edu.sctu.zhangwang.day201506;

import edu.sctu.nieyu.day20150526.Data;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * Created by user10 on 2015/6/10.
 */
public class Time {
    public void timeUtil(){

        Date date = new Date();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyy-MM-dd HH:mm:ss" );
        String timeOne = simpleDateFormat.format(date);

        System.out.println("开始时间为："+timeOne);

        Date time = null;
        try {
            time = simpleDateFormat.parse(timeOne);
        } catch (ParseException e) {
            e.printStackTrace();
        }

        Calendar calendar = Calendar.getInstance();

        calendar.setTime(time);
        calendar.add(calendar.MINUTE,6);
        time = calendar.getTime();
        String time2 = simpleDateFormat.format(time);
        System.out.println("结束时间为："+time2);
    }

    public static void main(String[] args) {
        Time time = new Time();
        time.timeUtil();
    }
}
